package r5.powtorka;

public class Employee extends Person {

	private double salary;

	public Employee(String name, double salary) {
		super(name);
		this.salary = salary;
	}

	public double getSalary() {
		return salary;
	}

	@Override
	public String getDescription() {
		return "Pracownik " + this.getName();
	}

	@Override
	public boolean equals(Object o) {
		if(this == o){
			System.out.println("1");
			return true;
		}
		if(o == null){
			System.out.println("2");
			return false;
		}
		if(!(o instanceof Employee)){
			System.out.println("3");
			return false;
		}
//		if(this.getClass() != o.getClass())
//			return false;
		Employee e = (Employee) o;
		return this.getName().equals(e.getName()) && this.salary == e.getSalary();
	}

	@Override
	public int hashCode() {
		return this.getName().hashCode();
	}

	@Override
	public String toString() {
		return this.getName() + ", " + this.salary;
	}

}
